package com.hanthink.web.controller.pc.report;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hanthink.common.annotation.Log;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.domain.AjaxResult;
import com.hanthink.common.core.page.TableDataInfo;
import com.hanthink.common.enums.BusinessType;
import com.hanthink.common.utils.poi.ExcelUtil;
import com.hanthink.system.domain.report.RepairFaultTypeTimeCollect;
import com.hanthink.system.service.report.IRepairFaultTypeTimeCollectService;

@RestController
@RequestMapping("/pc/report/repairFaultTypeTimeCollect")
public class RepairFaultTypeTimeCollectControll extends BaseController {

	@Autowired
	private IRepairFaultTypeTimeCollectService iRepairFaultTypeTimeCollectService;

	// 查询汇总信息列表
	@PreAuthorize("@ss.hasPermi('report:repairFaultTypeTimeCollect:list')")
	@GetMapping("/tableList")
	public TableDataInfo tableList(RepairFaultTypeTimeCollect repairFaultTypeTimeCollect) {
		startPage();
		List<RepairFaultTypeTimeCollect> list = iRepairFaultTypeTimeCollectService
				.queryTableList(repairFaultTypeTimeCollect);
		return getDataTable(list);
	}

	// 查询汇总柱形图
	@PreAuthorize("@ss.hasPermi('report:repairFaultTypeTimeCollect:list')")
	@GetMapping("/chartList")
	public AjaxResult chartList(RepairFaultTypeTimeCollect repairFaultTypeTimeCollect) {
		AjaxResult ajax = AjaxResult.success();
		List<RepairFaultTypeTimeCollect> list = iRepairFaultTypeTimeCollectService
				.queryChartList(repairFaultTypeTimeCollect);
		ajax.put("list", list);
		return ajax;
	}

	/**
	 * 导出汇总信息列表
	 */
	@PreAuthorize("@ss.hasPermi('report:repairFaultTypeTimeCollect:export')")
	@Log(title = "维修故障分类", businessType = BusinessType.EXPORT)
	@GetMapping("/export")
	public AjaxResult export(RepairFaultTypeTimeCollect repairFaultTypeTimeCollect) {
		List<RepairFaultTypeTimeCollect> list = iRepairFaultTypeTimeCollectService
				.queryTableList(repairFaultTypeTimeCollect);
		ExcelUtil<RepairFaultTypeTimeCollect> util = new ExcelUtil<RepairFaultTypeTimeCollect>(
				RepairFaultTypeTimeCollect.class);
		return util.exportExcel(list, "维修故障分类");
	}
}
